package com.bw.lib_router

import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.facade.callback.NavigationCallback
import com.bw.lib_base.path.RouterPath

/**
 * 局部降级策略
 */

class LocalDegradeCallback(private val path: String="",private val group:String="") :NavigationCallback{

    /**
     * 匹配到目标页面
     */
    override fun onFound(postcard: Postcard?) {
    }


    /**
     * 没匹配到目标页面
     */
    override fun onLost(postcard: Postcard) {
        postcard.group= if (!group.isNullOrEmpty()) group else RouterPath.GROUP_EMPTY
        postcard.path= if (!path.isNullOrEmpty()) path else RouterPath.PATH_EMPTY_PAGE
        postcard.navigation()
    }

    /**
     * 页面跳转成功
     */
    override fun onArrival(postcard: Postcard?) {
    }

    /**
     * 页面跳转被拦截
     */
    override fun onInterrupt(postcard: Postcard?) {
    }


}